home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / daemons / nfs / nfs-serv.2be / nfs-serv / nfs-server-2.2beta16 / BUILD < prev    next >
Encoding:
Text File  |  1996-01-31  |  9.2 KB  |  352 lines

  1. #!/bin/sh
  2.  
  3. #  Universal NFS Server 2.2beta4.1 configuration file
  4. #  Aug 18, 1995
  5. #  Copyright (C) 1995 Alexander O. Yuriev   <alex@bach.cis.temple.edu>  
  6. #                                CIS Laboratories, TEMPLE UNIVERSITY.
  7. #  GNU General Public License 2 or above terms apply.
  8. #
  9. #  Modified by Olaf Kirch.
  10. #
  11. function read_yesno {
  12.     ans=""
  13.     echo >&2
  14.     while test -z $ans; do
  15.         echo -n "$1 [y/n] " >&2
  16.         read ans
  17.         case $ans in
  18.         y*|Y*)    ans=Y;;
  19.         n*|N*)    ans=N;;
  20.         *)    echo "You must answer y or n" >&2
  21.             ans="";;
  22.         esac
  23.     done
  24.     echo $ans
  25. }
  26.  
  27. function read_ugid {
  28.     ans=""
  29.     while test -z $ans; do
  30.         echo -n "$2 [default $3 $4] " >&2
  31.         read ans
  32.         if [ -z "$ans" ]; then
  33.             ans=$3
  34.         elif expr "$ans" : "^[0-9]*$" >/dev/null; then
  35.             break;
  36.         else
  37.             ans=`id $1 $ans 2>/dev/null`
  38.         fi
  39.     done
  40.     echo $ans
  41. }
  42.  
  43. cat << EOF
  44.  
  45. ***********************************************************
  46. *     Universal NFS Server 2.2beta5 Autoconfiguration     *
  47. ***********************************************************
  48.  
  49.    This package is BETA software. Until the final 2.2
  50.    is released, please make sure you are using the latest
  51.    version that you can get from
  52.      
  53.          ftp://linux.nrao.edu/pub/people/okir/nfsd/
  54.      ftp://ftp.mathematik.th-darmstadt.de/pub/linux/okir
  55.  
  56.    Please also make sure you replace any older versions
  57.    of unfsd you are running.  Versions of the Universal
  58.    NFS Server prior to 2.2 had some security holes.
  59.  
  60.    Caveat: although the Universal NFS Server 2.0 was
  61.    originally written to support a set of different
  62.    platfroms, including AIX, SunOS and others, versions
  63.    above 2.0 were developed on Linux only. Thus, there
  64.    may be some portability problems on other OSes.
  65.  
  66.    If you have a bug report, please follow the instructions
  67.    in the file BUGS.
  68.  
  69. EOF
  70. # -------------- blurb excerpt removed -----------------
  71. #  This version is based on Olaf's version 2.2beta1
  72. #  with automatic exports access control and hooks for
  73. #  the experimental FoxbatSARS by Alex Yuriev.
  74.  
  75.  
  76. echo -n "Please press return to continue"
  77. read
  78.  
  79. cat << EOF
  80.  
  81. ***************************************************************
  82. *  Universal NFS Server 2.2beta5 Site Specific Configuration  *
  83. ***************************************************************
  84.  
  85.     Please answer the following questions to make the system
  86.     specific changes in configuration of the UNFS Server.
  87.  
  88. EOF
  89.  
  90. cat << EOF
  91. +---------------------+
  92. | ugidd configuration |
  93. +---------------------+
  94.  
  95. This release of unfsd supports dynamic mapping of uids and gids between
  96. hosts with different uid spaces. However, you should not use this feature
  97. unless you absolutely must, because it can pose a security risk: When run
  98. unprotected, the ugidd mapping daemon can be abused to obtain a complete
  99. list of all login names on your NFS client machine. As a counter-measure,
  100. ugidd can be protected with the hosts_access control mechanism used by
  101. Wietse Venema's tcp_wrapper package. Note that this does not offer a
  102. hundred percent protection, though, as it can still be spoofed by hosts
  103. on the same network as your client machine.
  104.  
  105. EOF
  106.  
  107. USE_UGIDD=`read_yesno "Are you going to use ugidd? (not recommended)"`
  108. if [ "$USE_UGIDD" = "Y" ]; then
  109.   echo " What can I say, its your system. I will use ugidd to map uid/gids."
  110.  
  111.   USE_HSTACS=`read_yesno "Do you want to protect ugidd with HOST ACCESS?"`
  112.   if [ "$USE_HSTACS" = "N" ]; then
  113.     echo " You like danger, I won't use wrappers to control access to ugidd."
  114.   else
  115.     echo " Okay, at least I will use wrappers to control access to ugidd."
  116.   fi
  117. else
  118.   echo " Good, I never liked ugidd."
  119. fi
  120.  
  121. if [ "$USE_HSTACS" = "Y" ]; then
  122.     LIBDIR=
  123.     echo
  124.     echo "Looking for libwrap.a... "
  125.     for libdir in /usr/lib /usr/local/lib; do
  126.         if [ -f $libdir/libwrap.a ]; then
  127.             echo " Okay, libwrap is in $libdir"
  128.             LIBDIR=$libdir;
  129.             break;
  130.         fi
  131.     done
  132.     if [ -z "$LIBDIR" ]; then
  133.         cat << EOF
  134.  
  135. To protect ugidd with host_access, you must have libwrap.a installed
  136. somewhere.  This library is part of the tcp_wrappers package. If you
  137. don't have it, please obtain the source from 
  138.  
  139.     ftp:/win.tue.nl:/pub/security/tcp_wrapper_X.Y.tar.gz
  140.  
  141. and compile it.
  142.  
  143. EOF
  144.         haveit=`read_yesno "Do you have libwrap.a installed?"`
  145.         if [ "$haveit" != "Y" ]; then
  146.             echo " Too bad. Aborting configuration."
  147.             exit 1;
  148.         fi
  149.  
  150.         while [ -z "$LIBDIR" ]; do
  151.             echo -n "Which directory is it installed in? "
  152.             read libdir
  153.             if [ -f $libdir/libwrap.a ]; then
  154.                 LIBDIR=$libdir
  155.             else
  156.                 echo " Can't find $libdir/libwrap.a"
  157.             fi
  158.         done
  159.     fi
  160.     HSTACS_LIBDIR=$LIBDIR
  161. fi
  162.  
  163. cat << EOF
  164. +-----------------------+
  165. | rquotad configuration |
  166. +-----------------------+
  167.  
  168. This release of unfsd supports disk quota management. The rquotad can be
  169. called by the client to check what quota has been assigned to the user.
  170. Even if you haven't configured your kernel to support disk quotas, you
  171. may still wish to run rquotad, because some rquota implementations will
  172. hang when there's no rquotad running on the NFS server.
  173.  
  174. If the configure script detects that your kernel doesn't have quota
  175. support, it will simply tell the client that no quota has been installed
  176. for that user and directory.
  177.  
  178. Note that this rquotad is fairly crude; there is a far better
  179. implementation contained in the quota patches.
  180.  
  181. EOF
  182.  
  183. USE_RQUOTAD=`read_yesno "Do you want to build rquotad?"`
  184.  
  185. cat << EOF
  186.  
  187. +------------------------------+
  188. | Access control configuration |
  189. +------------------------------+
  190.  
  191. Unfsd makes sure the exports file is always owned by the same user, and
  192. is not writable by anyone but that user. I will now ask you for the uid
  193. and gid of that user. Please enter appropriate user and group ids or names.
  194.  
  195. EOF
  196.  
  197. EXPSOWNUID=`read_ugid --user "Which uid should own /etc/exports?" 0 "(root)"`
  198. EXPSOWNGID=`read_ugid --group "Which gid should own /etc/exports?" 0 "(root)"`
  199.  
  200. cat << EOF
  201.  
  202. UNFS Server 2.2beta5 and later can log mount requests and their
  203. success/failure to syslogd. This can be very useful for systems
  204. that are not protected from internet by firewalls. (Actually, it should
  205. by very useful in all cases).
  206.  
  207. EOF
  208.  
  209. LOG_MOUNTS=`read_yesno "Do you want to log all mount reqests into syslog? (recommended) "`
  210. if [ "$LOG_MOUNTS" = "Y" ]; then
  211.   echo "  Good, I'd log all mount requests and their status into syslog"
  212. else
  213.   echo "  Well, don't say I did not offer..."
  214. fi 
  215.  
  216. echo
  217. echo "Creating custom configuration ..."
  218. echo "The following is your system specific configuration: "
  219. echo
  220. echo -n " *** User/Group ID Map Daemon is" 
  221. test $USE_UGIDD = "N" && echo -n " not"
  222. echo -n " used"
  223. if [ "$USE_UGIDD" = "Y" ] ; then
  224.   test $USE_HSTACS = "Y" && echo -n " but" || echo -n " but NOT"
  225.   echo " protected with host access control"
  226. else
  227.   echo
  228. fi
  229.  
  230. echo -n " *** Disk quota deamon is"
  231. if [ $USE_RQUOTAD = "Y" ]; then
  232.   echo " used"
  233. else
  234.   echo " not used"
  235. fi
  236.  
  237. echo " *** Exports Control files should be owned by UID=$EXPSOWNUID GID=$EXPSOWNGID"
  238. echo -n " *** Mount requests will "
  239. test $LOG_MOUNTS = "N" && echo -n "not "
  240. echo "be logged to syslogd(8)"
  241. # echo -n " *** Support for export of DOS filesystems "
  242. # test $USE_DOSFS && echo "enabled." || echo "disabled."
  243.  
  244. echo 
  245. echo "Updating site.h..."
  246.  
  247. (
  248. echo "/*"
  249. echo " * Site-specific configuration options generated by BUILD."
  250. echo " * Please do not edit."
  251. echo " */"
  252. echo
  253. echo "/*"
  254. echo " * If REAL_UGIDD is defined, the real rpc.ugidd is created,"
  255. echo " * otherwise, a dummy program is created"
  256. echo " */"
  257. if [ "$USE_UGIDD" = "Y" ]; then
  258.   echo "#define REAL_UGIDD"
  259. else
  260.   echo "#undef REAL_UGIDD"
  261. fi
  262. echo
  263. echo "/*"
  264. echo " * if HOSTS_ACCESS is defined, ugidd uses host access control"
  265. echo " * provided by libwrap.a from tcp_wrappers"
  266. echo " */"
  267.  
  268. if [  "$USE_HSTACS" = "Y" ]; then
  269.   echo "#define HOSTS_ACCESS"
  270. else
  271.   echo "/* #undef HOSTS_ACCESS */"
  272. fi  
  273. echo 
  274. echo "/*"
  275. echo " * Define correct ownership of export control file"
  276. echo " */"
  277. echo "#define EXPORTSOWNERUID  ((uid_t) $EXPSOWNUID)"
  278. echo "#define EXPORTSOWNERGID  ((gid_t) $EXPSOWNGID)"
  279. echo
  280. echo "/*"
  281. echo " * If WANT_LOG_MOUNTS is defined, every mount request will be logged"
  282. echo " * to syslogd with the name of source site and a path that was"
  283. echo " * it requested"
  284. echo " */"
  285. if [ "$LOG_MOUNTS" = "Y" ]; then
  286.   echo "#define WANT_LOG_MOUNTS"
  287. else
  288.   echo "#undef WANT_LOG_MOUNTS"
  289. fi
  290.  
  291. ) > site.h 
  292.  
  293. echo "Updating site.mk ..."
  294. (
  295. echo "#"
  296. echo "# Site-specific make options generated by BUILD. Please do not edit."
  297. echo "#"
  298. echo
  299. echo "# ugidd support"
  300. if [ $USE_UGIDD = "Y" ]; then
  301.   echo "UGIDD_PROG=\${rpcprefix}ugidd"
  302.   echo "UGIDD_MAN=ugidd"
  303. else
  304.   echo "UGIDD_PROG="
  305.   echo "UGIDD_MAN="
  306. fi
  307. echo "# rquotad support"
  308. if [ $USE_RQUOTAD = "Y" ]; then
  309.   echo "RQUOTAD_PROG=\${rpcprefix}rquotad"
  310.   echo "RQUOTAD_MAN="
  311. else
  312.   echo "RQUOTAD_PROG="
  313.   echo "RQUOTAD_MAN="
  314. fi
  315. echo "# Location of tcp_wrapper library"
  316. if [  "$USE_HSTACS" = "Y" ]; then
  317.   echo "LIBWRAP_DIR=-L$HSTACS_LIBDIR"
  318.   echo "LIBWRAP_LIB=-lwrap"
  319. else
  320.   echo "LIBWRAP_DIR="
  321.   echo "LIBWRAP_LIB="
  322. fi
  323. ) > site.mk
  324.  
  325. cat << EOF
  326.  
  327. I'm now running GNU configure to determine some system-specific things.
  328. This make take a while on your first attempt.
  329.  
  330. EOF
  331. echo -n "Please press return to continue "; read foo
  332.  
  333. sh configure
  334. if [ $? -ne 0 ]; then
  335.   echo
  336.   echo
  337.   echo " *** Warning: GNU configure exited with error code $?"
  338.   echo " *** Aborting installation. Please check the output of"
  339.   echo " *** configure."
  340.   echo
  341.   exit 2
  342. fi
  343.  
  344. cat << "EOF"
  345.  
  346. Uphh... Done. Now you can run `make install' to build and install the
  347. binaries and manpages.
  348.  
  349. EOF
  350. exit 0
  351.